
using System;
using System.Linq;
using Csla;
using Csla.Data;

namespace HousingInfo.Library
{ 
	public partial class VipHouseBOList : Csla.BusinessListBase<VipHouseBOList, VipHouseBO>
	{
        #region ham lay tat ca danh sach tin vip
        public static VipHouseBOList GetAllVipHousesBOList()
        {
            return DataPortal.Fetch<VipHouseBOList>();
        }
        #endregion
		#region Authorization Rules

		protected static void AddObjectAuthorizationRules()
		{
			//TODO: Define object-level authorization rules of VipHouseBOList
			//AuthorizationRules.AllowCreate(typeof(VipHouseBOList), "VipHouseBOListCreateGroup"));
			//AuthorizationRules.AllowEdit(typeof(VipHouseBOList), "VipHouseBOListEditGroup"));
			//AuthorizationRules.AllowDelete(typeof(VipHouseBOList), "VipHouseBOListDeleteGroup"));
		}
		#endregion //Authorization Rules
        #region truy cap du lieu cua ham lay tat ca danh sach tin vip
        [Transactional(TransactionalTypes.TransactionScope)]
        private void DataPortal_Fetch()
        {
            bool cancel = false;
            if (cancel) return;

            using (var mgr = ContextManager<HousingInfo.DataLinQ.HousingInfoDataContext>
                        .GetManager(Database.HousingInfoConnection))
            {
                RaiseListChangedEvents = false;

                this.AddRange(
                    from row in mgr.DataContext.VipHouses
                    select VipHouseBO.GetVipHouseBO(row.VipHouseID)
                );
                RaiseListChangedEvents = true;
            }//using
        }
        #endregion
	}
}
